package com.woniuxy.movice.handler;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.woniuxy.movice.entity.Cinema;
import com.woniuxy.movice.mapper.PayMapper;
import com.woniuxy.movice.service.CinemaService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.Data;

@Data
@Controller
@RequestMapping("/cinema")
@Api("电影院信息")
public class CinemaController {
	
	@Resource
	private CinemaService cinemaService;
	
	@ApiOperation(value="展示所有影院")
	@RequestMapping(value="/showAllCinema",method=RequestMethod.GET)
	@ResponseBody
	public List<Cinema> showAllCinema(){
		return cinemaService.showAllCinema();
	}
	
	@ApiOperation(value="通过电影院id查询电影院信息",notes="传入电影院id")
	@RequestMapping(value="/showCinemaById",method=RequestMethod.POST)
	@ResponseBody
	public Cinema showCinemaById(int yid){
		return cinemaService.showCinemaById(yid);
	}
	
	@ApiOperation(value="添加评论",notes="传入评论信息")
	@RequestMapping(value="/addComment",method=RequestMethod.POST)
	@ResponseBody
	public String addComment(float agrade,String acomment){
		String re="请先登录!";
		//从SESSION中取出uid
		int uid=1;
		if(uid==0) {
			return re;
		}
		re=cinemaService.addComment(agrade,acomment,uid);
		return re;
	}

}
